//author:jxx
//此处是对表单的方法，组件，权限操作按钮等进行任意扩展(方法扩展可参照SellOrder.js)
import gridFooter from "./order/small_order_item.vue";
let extension = {
  components: {//动态扩充组件或组件路径
    //表单header、content、footer对应位置扩充的组件
    gridHeader: '',//{ template: "<div>扩展组xx件</div>" },
    gridBody: '',
    gridFooter: gridFooter,
    //gridFooter: gridFooter,
    //弹出框(修改、编辑、查看)header、content、footer对应位置扩充的组件
    modelHeader: '',
    modelBody: '',
    modelFooter: ''
  },
  buttons: { view: [], box: [], detail: [] },//扩展的按钮
  methods: {//事件扩展
    onInit () {
      this.maxBtnLength = 4;
      this.pagination.sortName = "refundOfTime";  //设置排序字段
      this.pagination.order = "desc"; //排序方式desc或者asc
      this.searchFormFields.is_pay = 3;
      this.$store.getters.data().order = this;
      this.const.PAGE = 'GetRefundOrder'
    },
    destroyed() {
      this.const.PAGE = 'getPageData'
    },
    onInited () {
      //this.height = this.height-300;
      this.detailOptions.height = this.detailOptions.height - 200;
      //设置主表求字段，后台需要实现SummaryExpress方法
    },
    rowClick ({ row, column, event }) { //查询界面table点击行选中当前行
      //console.log(row,column,event);
      let where = {
        sort: "order_id",
        value: row.id,
        wheres: [
          { "name": "refundStatus", "value": 2, displayType: "text" },
          //设置为like模糊查询
        ]
      };

      this.$refs.table.$refs.table.toggleRowSelection(row);
      this.$refs.gridFooter.$refs.tableList.load(where)
      if (this.$refs.table.getSelected().length > 1) {
        this.$refs.gridFooter.$refs.tableList.reset()
      }
      return true;
    },
    searchAfter (rows) {
      //页面加载或者刷新数据后直接显示第一行的明细
      if (rows.length) {
        let where = {
          wheres: [
            { "name": "order_id", "value": rows[0].id, displayType: "text" },
            //设置为like模糊查询
          ]
        };
        // this.$nextTick(() => {
        this.$refs.gridFooter.$refs.tableList.load(where)
        // })
      } else {
        //没有数据时，清空明细数据
        this.$refs.gridFooter.$refs.tableList.reset()
      }

      return true;

    },
  }
};
export default extension;
